function ShellInsert(arr, dk) {
    for (let i = dk + 1; i < arr.length; i++) {
        if (arr[i] < arr[i - dk]) {
            let j;
            arr[0] = arr[i];
            for (j = i - dk; j > 0 && arr[j] > arr[0]; j -= dk) {
                arr[j + dk] = arr[j];
            }
            arr[j + dk] = arr[0];
        }
    }
}

function ShellSort(arr, dt) {
    for (let i = 0; i < dt.length; i++) {
        ShellInsert(arr, dt[i]);
    }

    return arr.slice(1);
}

let arr = [-1, 49, 38, 65, 97, 76, 13, 27, 49, 55, 4]; // arr[0]闲置或者作为哨兵单元
let dt = [5, 3, 1]; // 增量

arr = ShellSort(arr, dt);

console.log(arr)